<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>vuejs</title>
    <script src="vue.js"></script>
</head>
<body>
<div id="app1">
    <my-component></my-component>
</div>

<div id="app2">
    <my-component></my-component>
</div>

<!--该组件不会被渲染-->
<my-component></my-component>

</body>
<script>
    var myComponent = Vue.extend({
        template: '<div>This is a component!</div>'
    });

    Vue.component('my-component', myComponent);

    var app1 = new Vue({
        el: '#app1'
    });

    var app2 = new Vue({
        el: '#app2'
    })
</script>
</html>